#include <QPushButton>
#include "panelescala.h"


char* nombresNotas1[12] = { "do", "do#", "re", "re#", "mi", "fa", "fa#", "sol", "sol#", "la", "la#", "si" };
char* nombresNotas2[12] = { "do", "reb", "re", "mib", "mi", "fa", "solb", "sol", "lab", "la", "sib", "si" };

PanelEscala::PanelEscala(QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);

    generarOctava();
}

PanelEscala::~PanelEscala()
{

}

void PanelEscala::generarOctava()
{
    for (int i = 0; i < 12; i++) {
        agregarNotaAOctava(i);
    }
}

void PanelEscala::agregarNotaAOctava(int i)
{
    QLabel* etiquetaSuperior = new QLabel(this);
    etiquetaSuperior->setText(nombresNotas1[i]);
    etiquetaSuperior->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    ui.gridLayout->addWidget(etiquetaSuperior, 0, i);

    QPushButton* boton = new QPushButton(this);
    boton->setObjectName(QString("boton%1").arg(i, 2, 10, QLatin1Char('0')));
    boton-> setCheckable(true);
    ui.gridLayout->addWidget(boton, 1, i);

    QLabel* etiquetaInferior = new QLabel(this);
    etiquetaInferior->setText(nombresNotas2[i]);
    etiquetaInferior->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    ui.gridLayout->addWidget(etiquetaInferior, 2, i);
}